local zcdiy_shanjia = fk.CreateSkill {
    name = "zcdiy_shanjia",
}

Fk:loadTranslationTable {
    ["zcdiy_shanjia"] = "缮甲",
    [":zcdiy_shanjia"] = "摸牌阶段开始时，你可以放弃摸牌，改为观看牌堆顶的X张牌并获得其中任意三张，将剩余的牌置入弃牌堆(X为你装备区的牌数+3)。",

    ["$zcdiy_shanjia1"] = "虎豹骑，皆天下骁锐！",
    ["$zcdiy_shanjia2"] = "缮取治军之道，安抚众军之心",
}

zcdiy_shanjia:addEffect(fk.EventPhaseStart, {
    anim_type = "control",
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(zcdiy_shanjia.name) and player.phase == Player.Draw
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        data.phase_end = true
        local cards = room:getNCards(3 + #player:getCardIds("e"))
        room:turnOverCardsFromDrawPile(player, cards, zcdiy_shanjia.name)
        local result = room:askToGuanxing(player, {
            cards = cards,
            top_limit = { 0, #cards },
            bottom_limit = { 3, 3 },
            skill_name = zcdiy_shanjia.name,
            skip = true,
            area_names = { "牌堆顶", "要获得" }
        })
        if #result.bottom > 0 then
            room:moveCardTo(result.bottom, Player.Hand, player, fk.ReasonJustMove, zcdiy_shanjia.name, nil, true, player)
        end
        room:moveCardTo(result.top, Card.DiscardPile, player, fk.ReasonPutIntoDiscardPile, zcdiy_shanjia.name,
            nil, true, player)
    end,
})

return zcdiy_shanjia
